<?php
/**
 * Created by PhpStorm.
 * User: zhanghua
 * Date: 2018/9/19
 * Time: 8:53
 */

namespace app\dlc\controller;

use app\common\controller\SunBaseController;
use app\dlc\model\AdminRole;
use app\dlc\service\AdminService;

class IndexController extends SunBaseController
{
    public function index()
    {
        $menus = AdminService::getMenu();

        //一级菜单
        $menuLevel1 = $menuLevel2 = [];

        foreach ($menus as $menu){
            if($menu['menu_pid'] == 0){
                $menuLevel1[] = $menu;
            }else{
                $menuLevel2[] = $menu;
            }
        }

        $this->assign('menuLevel1',$menuLevel1);
        $this->assign('menuLevel2',$menuLevel2);

        return $this->fetch();
    }



}
